using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class UserProfile
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region UserProfileSelectAll
        public static SqlDataReader UserProfileSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "UserProfileSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "UserProfileSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region UserProfileSelectRow
        public static SqlDataReader UserProfileSelectRow(int UserId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "UserProfileSelectRow", UserId);
            return SqlHelper.ExecuteReader(m_trConnectionString, "UserProfileSelectRow", UserId);
        }
        #endregion
       #region UserProfileInsertRow
        public static void UserProfileInsertRow(string UserName, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "UserProfileInsertRow", UserName);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "UserProfileInsertRow", UserName);
        }
        #endregion
       #region UserProfileUpdateRow
        public static void UserProfileUpdateRow(int UserId, string UserName, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "UserProfileUpdateRow", UserId, UserName);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "UserProfileUpdateRow", UserId, UserName);
        }
        #endregion
       #region UserProfileDeleteRow
        public static void UserProfileDeleteRow(int UserId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "UserProfileDeleteRow", UserId);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "UserProfileDeleteRow", UserId);
        }
        #endregion

    }
}

